#include <iostream>
#include <vector>
using namespace std;
 
int getVal(int a, int b)
{
    if (a > b)
        swap(a, b);
    for (int i = a; i >= 1; --i)
    {
        if (a % i == 0 && b % i == 0)
            return i;
    }
    return -1;
}
 
int main()
{
    int n = 0, c = 0;
    while (cin >> n >> c)
    {
        vector<int> arr(n);
        for (int i = 0; i < n; ++i)
        {
            cin >> arr[i];
        }
        for (int i = 0; i < n; ++i)
        {
            if (arr[i] <= c)
                c += arr[i];
            else
                c += getVal(c, arr[i]);
        }
        cout << c << endl;
    }
    return 0;
}